<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <body>
        <ui:composition template="templateGeneral.xhtml">
            <ui:define name="title">Azuriraj studenta</ui:define>
            <ui:define name="center">
                
                <h2 style="margin-left: 20px"><h:outputText value="Dodavanje student" /></h2>
                <h:form id="dodajStudenta">
                    <p:growl id="message" sticky="false"/>
                    <p:selectOneMenu value="#{adminDodajOsobu.selectedStudentString}" filter="true" filterMatchMode="contains" style="min-width: 300px">
                        <p:ajax event="change" listener="#{adminDodajOsobu.onChangeStudent}" update=":dodajStudenta:podaciStudenta"/>
                        <f:selectItem itemLabel="Odaberi studenta" itemValue=""/>
                        <f:selectItems value="#{adminDodajOsobu.studentList}" /> 
                    </p:selectOneMenu>
                    <h:panelGrid id="podaciStudenta" columns="2" cellpadding="10">

                        <h:outputText value="Korisniko Ime: " style="font-weight:bold"/>
                        <p:inputText  value="#{adminDodajOsobu.selectedStudent.korisnik.korisnickoIme}" required="true" requiredMessage="Morate uneti korisnicko ime"/>

                        <h:outputText value="Lozinka " style="font-weight:bold"/>
                        <p:password  id="pass1" label="Lozinka" value="#{adminDodajOsobu.selectedStudent.korisnik.lozinka}" match="pass2" required="true" requiredMessage="Morate uneti lozinku"/>

                        <h:outputText value="Ponovi lozinku " style="font-weight:bold"/>
                        <p:password id="pass2" label="Ponovljena lozinka" value="#{adminDodajOsobu.reenteredPassword}" required="true" requiredMessage="Morate uneti lozinku"/>

                        <h:outputText value="Indeks " style="font-weight:bold"/>
                        <p:inputText value="#{adminDodajOsobu.selectedStudent.indeks}" required="true" requiredMessage="Morate uneti indeks"/>

                        <h:outputText value="Ime " style="font-weight:bold"/>
                        <p:inputText  value="#{adminDodajOsobu.selectedStudent.korisnik.ime}" required="true" requiredMessage="Morate uneti ime"/>

                        <h:outputText value="Prezime " style="font-weight:bold"/>
                        <p:inputText  value="#{adminDodajOsobu.selectedStudent.korisnik.prezime}" required="true" requiredMessage="Morate uneti prezime"/>

                        <h:outputText value="Adresa " style="font-weight:bold"/>
                        <p:inputText  value="#{adminDodajOsobu.selectedStudent.adresa}" required="true" requiredMessage="Morate uneti adresu"/>

                        <h:outputText value="Telefon " style="font-weight:bold"/>
                        <p:inputText  value="#{adminDodajOsobu.selectedStudent.telefon}"/>

                        <h:outputText value="Tip studija "  style="font-weight:bold"/>
                        <p:selectOneMenu value="#{adminDodajOsobu.selectedStudent.tip}">
                            <f:selectItem itemValue="d" itemLabel="Osnovne"/>
                            <f:selectItem itemValue="m" itemLabel="Master"/>
                            <f:selectItem itemValue="p" itemLabel="Doktorske"/>
                        </p:selectOneMenu>
                        
                        <h:outputText value="Status "  style="font-weight:bold"/>
                        <p:selectOneMenu value="#{adminDodajOsobu.selectedStudent.status}">
                            <f:selectItem itemValue="Aktivan" itemLabel="Aktivan"/>
                            <f:selectItem itemValue="Neaktivan" itemLabel="Neaktivan"/>
                        </p:selectOneMenu>


                        <h:commandButton value="Snimi" actionListener="#{adminDodajOsobu.azirirajStudenta}" rendered="#{adminDodajOsobu.imaStudent}"/>
                    </h:panelGrid>
                </h:form>
                </ui:define>
        </ui:composition>
    </body>
</html>
